<?php

class Application_Form_Location extends Zend_Form {

    public function init() {
        $this->setAction('/location/validate')
                ->setMethod('post')
                ->setAttrib('id', 'locationForm')
                ->setDecorators(MusicEvent_Decorator_Decorator::Form());

        /* Location */
        $this->addElement('text', 'location', array(
            'decorators' => MusicEvent_Decorator_Decorator::MultiLineElement(),
            'label' => 'Location',
            'validators' => array(
                array('NotEmpty', true, array(
                        'messages' => 'Insert an location',
                ))),
            'filter' => 'StripTags',
            'required' => true,
            'attribs' => array(
                'class' => 'large'
            ),
        ));

        /* Within */
        $this->addElement('select', 'within', array(
            'decorators' => MusicEvent_Decorator_Decorator::MultiLineElement(),
            'label' => 'Within',
            'multiOptions' => array(
                'all' => '',
                '5' => '5 km',
                '10' => '10 km',
                '15' => '15 km',
                '20' => '20 km',
                '25' => '25 km'),
            'default' => 'all',
            'attribs' => array(
                'class' => 'small'
            ),
        ));

        /* search button */
        $this->addElement('submit', 'Search', array(
            'decorators' => MusicEvent_Decorator_Decorator::Submit()
        ));
    }

}

